package kr.co.hanbit;

import java.util.StringTokenizer;

 class StringTokenEx1 {

	StringTokenizer st;
	public StringTokenEx1(String str){
		System.out.println("str : " + str);
		st = new StringTokenizer(str);
	}
	
	public StringTokenEx1(String str, String delim){
			System.out.println("str : " + str);
			st = new StringTokenizer(str, delim);
		}
	
	public void print(){
		System.out.println("Token count : " + st.countTokens());
		while(st.hasMoreTokens()){
			String token = st.nextToken();
			System.out.println(token);
		}
		System.out.println("--------------------------");
	}
		
	public static void main(String[] args) {
		StringTokenEx1 st1 = new StringTokenEx1("Happy day");
		st1.print();
		System.out.println("11111111111122222222222222222222");
		StringTokenEx1 st2 = new StringTokenEx1("2005/08/15","/");
		st2.print();

	}
}
/* 
str : Happy day
Token count : 2
Happy
day
--------------------------
11111111111122222222222222222222
str : 2005/08/15
Token count : 3
2005
08
15
--------------------------

*/